package br.com.fpu.everton.northwind.database.entities.keys;

import javax.persistence.Embeddable;


import br.com.fpu.everton.northwind.database.utils.BaseKey;

@Embeddable
public class OrderDetailKeyEntity extends BaseKey {

	private static final long serialVersionUID = -2817881230971112397L;

	private int orderId;

	private int productId;

	public int getOrderId() {
		return this.orderId;
	}

	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}

	public int getProductId() {
		return this.productId;
	}

	public void setProductId(int productId) {
		this.productId = productId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;

		result = prime * result + this.orderId;
		result = prime * result + this.productId;

		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;

		if (!super.equals(obj))
			return false;

		if (getClass() != obj.getClass())
			return false;

		OrderDetailKeyEntity other = (OrderDetailKeyEntity) obj;

		if (this.orderId != other.orderId)
			return false;

		if (this.productId != other.productId)
			return false;

		return true;
	}

}
